<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/9/14
  Time: 17:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <title>ERP系统 - 合同信息添加</title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/css/main.css">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/lib/font-awesome/css/font-awesome.css">
    <script type="text/javascript" src="<%=request.getContextPath()%>//static/lib/jquery/jquery.js"></script>
    <script type="text/javascript">
        $(function (){

        })
        function check(tex){
            var mach = /^\d$/;
            if(mach.test(tex.val())){
                tex.next().text("")
                return true;
            }else{
                tex.next().text("需要输入的为数字");
                return false;
            }
        }
        function checkH(){
            var $el = $("input[name=hId]");
            return check($el);
        }
        function checkL(){
            var $cl = $("input[name=lId]");
            return check($cl);
        }
        function checkMoney(){
            var $mon = $("input[name=cRental]");
            return checkd($mon);
        }
        function checkCash(){
            var $cash = $("input[name=cCash]");
            return checkd($cash);
        }
        function checkd(e){
            var mach = /^([1-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/;
            if(mach.test(e.val())){
                e.next().text("");
                return true;
            }else{
                e.next().text("需要输入整数或数字");
                return false;
            }
        }
        function overCheck(){
            return checkH()&&checkL()&&checkMoney()&&checkCash();
        }
    </script>
</head>
<body>
    <div class="box">
        <h3>添加合同信息</h3>
        <form action="<%=request.getContextPath()%>/contract/doAdd" onsubmit="return overCheck()" method="post">
            <table class="form-table">

                <tr>
                    <td>合同房子编号</td>
                    <td colspan="3" class="control">
                        <input type="text" name="hId" onblur="checkH()" placeholder="合同房子编号">&nbsp;
                        <span style="color: red"></span>
                        <input type="hidden" name="cName" value="xxxx">
                    </td>
                </tr>
                <tr>
                    <td>合同租户编号</td>
                    <td colspan="3" class="control">
                        <input type="text" name="lId" onblur="checkL()" placeholder="合同租户编号">&nbsp;
                        <span style="color: red"></span>
                    </td>
                </tr>
                <tr>
                    <td>合同签订时间</td>
                    <td colspan="3" class="control">
                        <input type="date" name="onTime" placeholder="合同签订时间">
                    </td>
                </tr>
                <tr>
                    <td>合同生效时间</td>
                    <td colspan="3" class="control">
                        <input type="date" name="startTime" placeholder="合同生效时间">
                    </td>
                </tr>
                <tr>
                    <td>合同失效时间</td>
                    <td colspan="3" class="control">
                        <input type="date" name="overTime" placeholder="合同失效时间">
                    </td>
                </tr>
                <tr>
                    <td>房租总额</td>
                    <td colspan="3" class="control">
                        <input type="text" name="cRental" onblur="checkMoney()" placeholder="房租总额">&nbsp;
                        <span style="color: red"></span>
                    </td>
                </tr>
                <tr>
                    <td>房租支付方式</td>
                    <td colspan="3" class="control">
                        <input type="text" name="cCash" onblur="checkCash()" placeholder="房租支付方式">&nbsp;
                        <span style="color: red"></span>
                    </td>
                </tr>


            </table>
            <div class="buttons">
                <input class="btn btn-primary va-bottom" type="submit" value="保存">&nbsp;&nbsp;
                <a class="btn btn-default" href="javascript:history.go(-1)">返回</a>
            </div>
        </form>
    </div>
</body>
</html>
